3 Problem Name : Babel Towers
4 Algorithm : Math, Center of Masses
24 #define min(a,b) ((a) < (b) ? (a) : (b))
25 #define max(a,b) ((a) > (b) ? (a) : (b))
27 #define CLR(a) memset(a,0,sizeof(a))
30 const double eps
= 1e-7;
33 double sumMass
[MAX
],sumX
[MAX
],sumY
[MAX
];
46 scanf("%lf %lf %lf",&C
[i
].x
,&C
[i
].y
,&C
[i
].r
);
47 sumX
[i
]=sumX
[i
-1]+C
[i
].x
*C
[i
].r
*C
[i
].r
;
48 sumY
[i
]=sumY
[i
-1]+C
[i
].y
*C
[i
].r
*C
[i
].r
;
49 sumMass
[i
]=sumMass
[i
-1]+C
[i
].r
*C
[i
].r
;
63 sM
=sumMass
[i
]-sumMass
[j
];
68 if((X
-C
[j
].x
)*(X
-C
[j
].x
)+(Y
-C
[j
].y
)*(Y
-C
[j
].y
)+eps
>C
[j
].r
*C
[j
].r
)
73 if(i
==n
+1) puts("Feasible");
74 else printf("Unfeasible %d\n",i
-1);